<?php

namespace App\Events\OpenShop;

use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

class SignSiteMissionEvent
{
    use Dispatchable, InteractsWithSockets, SerializesModels;

    public string $orderNo; // 订单编号
    public string $nowStepId; // 当前任务序号[暂时无用]
    public string $nowStepStatus; // 当前任务stepStatus
    public int    $dealUid; // 处理人
    public bool   $finishNowStep; // 是否完成当前任务

    public function __construct(string $orderNo, int $nowStepStatus, int $dealUid, bool $finishNowStep = true)
    {
        $this->orderNo       = $orderNo;
        $this->nowStepStatus = $nowStepStatus;
        $this->dealUid       = $dealUid;
        $this->finishNowStep = $finishNowStep;
    }

    /**
     * Get the channels the event should broadcast on.
     *
     * @return \Illuminate\Broadcasting\Channel|array
     */
    public function broadcastOn()
    {
        return new PrivateChannel('channel-name');
    }
}
